package com.becca.cake.service.couponRule;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;

import com.becca.cake.core.exception.ServiceException;
import com.becca.cake.model.coupon.GoodsPriceSizeRuleModel;
import com.becca.cake.model.coupon.PartookCouponRuleModel;
import com.becca.cake.model.coupon.RuleGroupModel;
import com.becca.cake.model.coupon.SalesRuleGroupModel;
import com.becca.cake.model.coupon.SalesRuleModel;
import com.becca.cake.model.goods.GoodsPriceSizeTreeModel;
import com.becca.cake.model.goods.GoodsTreeModel;
import com.becca.cake.model.users.UserCouponModel;

/**
 * 分享红包规则Service接口
 * @copyright  尊星(上海)信息科技有限公司
 * @author yellow
 * @date 2016年6月7日 下午5:03:23
 */
public interface ICouponRuleService {
    /**
     * 查询红包规则列表
     * @param map
     * @return
     * @throws ServiceException
     */
    List<PartookCouponRuleModel> selectCouponRule(Map<String, Object> map) throws ServiceException;

    /**
     * 
     * 获取红包规则总条数
     * @param map
     * @return
     * @throws ServiceException
     */
    Long selectCouponRuleCount(Map<String, Object> map) throws ServiceException;

    /**
     * 根据id查红包规则对象
     * @param id
     * @return
     * @throws ServiceException
     */
    PartookCouponRuleModel selectCouponRuleById(Integer id) throws ServiceException;

    /**
     * 修改红包规则信息
     * @param goodsModel
     * @throws ServiceException
     */
    void updateCouponRule(PartookCouponRuleModel partookCouponRuleModel, String trueName)
                                                                                         throws ServiceException;

    /**
     * 修改红包规则enable
     * @param map
     * @throws ServiceException
     */
    void updCouponRuleIsEnable(Map<String, Object> map) throws ServiceException;

    /**
     *  查询用户优惠券
     * @param map
     * @return
     * @throws ServiceException
     */
    List<UserCouponModel> selectUserCoupon(Map<String, Object> map) throws ServiceException;

    /**
     * 
     * 获取优惠券总条数
     * @param map
     * @return
     * @throws ServiceException
     */
    Long selectUserCouponCount(Map<String, Object> map) throws ServiceException;

    /**
     * 添加用户红包：赠送红包
     * @param userCouponModel
     * @throws DataAccessException
     */
    void insertUserCoupon(Map<String, Object> map) throws ServiceException;

    /**
     * 赠送全部用户红包
     * @param map
     * @throws ServiceException
     */
    void insertAllUserCoupon(Map<String, Object> map) throws ServiceException;

    /**
     *  查询规则组
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<RuleGroupModel> selectRuleGroup(Map<String, Object> map) throws ServiceException;

    /**
     * 查询规则组总条数
     * @param map
     * @return
     * @throws ServiceException
     */
    Long selectRuleGroupCount(Map<String, Object> map) throws ServiceException;

    /**
     * 根据规则组id查询规则组对象
     * @param id
     * @return
     * @throws ServiceException
     */
    RuleGroupModel queryRuleGroupById(Integer id) throws ServiceException;

    /**
     * 添加规则组对象
     * @param id
     * @return
     * @throws ServiceException
     */
    void insertOrUpdateRuleGroup(RuleGroupModel ruleGroupModel, String trueName)
                                                                                throws ServiceException;

    /**
     *  查询规则管理列表
     * @param map
     * @return
     * @throws ServiceException
     */
    List<SalesRuleModel> selectSalesRule(Map<String, Object> map) throws ServiceException;

    /**
     * 查询规则管理列表总条数
     * @param map
     * @return
     * @throws ServiceException
     */
    Long selectSalesRuleCount(Map<String, Object> map) throws ServiceException;

    /**
     * 规则组中添加选择中规则
     * @param salesRuleIds
     * @throws ServiceException
     */
    void updSalesRuleGroup(Map<String, Object> map) throws ServiceException;

    /**
     * 根据规则组ID查询规则
     * @param ruleGroupId
     * @return
     * @throws ServiceException
     */
    List<SalesRuleGroupModel> querySalesRuleGroupById(Integer ruleGroupId) throws ServiceException;

    /**
     * 添加规则
     * @param salesRuleModel
     * @throws ServiceException
     */
    void insertOrUpdateSalesRule(SalesRuleModel salesRuleModel, String trueName)
                                                                                throws ServiceException;

    /**
     * 根据id查询规则对象
     * @param salesRuleModel
     * @throws ServiceException
     */
    SalesRuleModel querySalesRuleById(Integer id) throws ServiceException;

    /**
     * 根据id修改规则是否可用
     * @param map
     * @throws ServiceException
     */
    void updIsEnableById(Map<String, Object> map) throws ServiceException;

    /**
     * 查询商品Tree
     * 
     * @throws ServiceException
     */
    List<GoodsTreeModel> selectGoodsTree(Integer goodsStatus, Integer isDelete)
                                                                               throws ServiceException;

    /**
     * 查询商品规格Tree
     * 
     * @throws ServiceException
     */
    List<GoodsPriceSizeTreeModel> selectGoodsPriceSizeTree(Map<String, Object> map)
                                                                                   throws ServiceException;

    /**
     * 修改商品规格
     * @param map
     * @throws ServiceException
     */
    void updateGoodsRule(Integer salesRuleId, String[] goodsPriceSizeIds) throws ServiceException;

    /**
     * 查询需要选中的规格
     * @param salesRuleId
     * @throws ServiceException
     */
    List<GoodsPriceSizeRuleModel> selectGoodsBySalesRuleId(Integer salesRuleId)
                                                                               throws ServiceException;
}
